package com.hunttown.mes.rpc.domain.enums.pay;

import java.util.HashMap;
import java.util.Map;

/**
 * 支付渠道
 * <p>
 * created by wangjunfu on 2019/08/19
 */
public enum PayChannelEnum {
    WXML(1, "小程序"),
    WXAPP(2, "公众号"),
    PCWEB(3, "PC"),
    IOS(4, "IOS"),
    IPAD(5, "IPAND"),
    ANDROID(6, "ANDROID");

    private final int key;
    private final String value;

    PayChannelEnum(int key, String value) {
        this.key = key;
        this.value = value;
    }

    // 根据key获取枚举
    public static String getEnumByKey(int key) {
        String value = "";

        for (PayChannelEnum temp : PayChannelEnum.values()) {
            if (temp.getKey() == key) {
                value = temp.getValue();
            }
        }

        return value;
    }

    // 将枚举组成Map
    public static Map<Integer, String> getEnumList() {
        Map<Integer, String> map = new HashMap<>();

        for (PayChannelEnum temp : PayChannelEnum.values()) {
            map.put(temp.getKey(), temp.getValue());
        }

        return map;
    }

    public int getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }
}
